﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AnalyseServer
{
    public partial class ucChartSensor : UserControl
    {
        //float maxValue = float.MaxValue;
        public ucChartSensor()
        {
            InitializeComponent();
        }

        public void SetMaxValue(float max)
        {
            //maxValue = max;

            chartSensor.ChartAreas["ChartArea1"].AxisY.Maximum = Math.Abs(max);
            chartSensor.ChartAreas["ChartArea1"].AxisY.Minimum = -Math.Abs(max);
        }

        public void SetChartTitle(string title)
        {
            chartSensor.Titles["Title1"].Text = title;
            
        }

        public void ApplyChartValue(float[] yPoints)
        {
            chartSensor.Series["Series1"].Points.Clear();
            for (int i = 0; i < yPoints.Length; i++)
                chartSensor.Series["Series1"].Points.AddY(yPoints[i]);
            
            chartSensor.Invalidate();
        }
    }
}
